/*
 * @Author: QMZhao
 * @Description: 
 * @Date: 2023-01-05 09:43:49
 * @LastEditTime: 2023-01-28 17:36:04
 * @Reference: 
 */
import { defineConfig, UserConfig, ConfigEnv } from "vite";
import { resolve } from "path";
import UnoCSS from 'unocss/vite'

import uni from "@dcloudio/vite-plugin-uni";

function pathResolve(dir: string) {
  return resolve(process.cwd(), ".", dir);
}

// https://vitejs.dev/config/
// export default defineConfig({
// plugins: [uni()],
// });
// export default ({ command, mode }: ConfigEnv): UserConfig => {
//   return {

// base: VITE_PUBLIC_PATH,
export default defineConfig({
  plugins: [uni(), UnoCSS(),],
  resolve: {
    alias: {
      "@": pathResolve("src")
    }
  },
  server: {
    // 默认启动浏览器
    open: true
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `
            @import "./src/styles/variables";
            @import "./src/styles/mixins";
          `
      }
    }
  }
})
